package com.sxf.auth.login.controller;


import com.sxf.auth.login.service.SmsService;
import com.sxf.auth.login.vo.SendSmsCodeReq;
import com.sxf.auth.login.vo.SendSmsCodeRes;
import com.sxf.common.param.ResultInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "发送短信相关")
@RestController
@RequestMapping("/sms")
public class SmsController {

	@Autowired
	private SmsService smsService;

	@PostMapping("/sendCode")
	@ApiOperation(value = "发送短信", produces = "application/json", httpMethod = "POST")
	public ResultInfo<SendSmsCodeRes> sendCode(@RequestBody @Validated SendSmsCodeReq sendCodeDTO) {
		return ResultInfo.success(smsService.sendCode(sendCodeDTO));
	}

//	@PostMapping("/validateSmsCode")
//	@ApiOperation(value = "校验短信", produces = "application/json", httpMethod = "POST")
//	public ResultInfo<Map<String, String>> validateSmsCode(@RequestBody @Validated ValidateSmsCodeReq validateSmsCodeDTO) {
//		return ResultInfo.success(smsService.validate(validateSmsCodeDTO));
//	}
}
